package net.cnki.sunny.controller;

import net.cnki.sunny.common.ResultVO;
import net.cnki.sunny.model.dto.OperateLogDTO;
import net.cnki.sunny.model.dto.StatisticsDTO;
import net.cnki.sunny.service.OperateLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OperateLogController {

    @Autowired
    private OperateLogService operateLogService;

    @PostMapping("/logs")
    public ResultVO getOperationLogs(@RequestBody OperateLogDTO operateLogDTO) {
        return new ResultVO().success(operateLogService.selectByCondition(operateLogDTO));
    }

    @GetMapping("/log/statistics")
    public ResultVO StatisticsOperateLog(StatisticsDTO statisticsDTO) {
        return new ResultVO().success(operateLogService.statisticsOperateLog(statisticsDTO));
    }
}
